// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
import QtQuick 1.1
import "../delegates"
import "../models"

GridView {
    id: mounthJobs

    signal dateChanged()
    property int fromTime: model.fromTime + (currentIndex >= 0 ? currentIndex*60*60*24 + 60*60*8 : 0)

    width: 100
    height: 100
    cellWidth: 24
    cellHeight: 24

    model: mounthJobModel
    delegate: DayCalendarElement {}
    header: Item {
        width: 100
        height: 24
        Row {
            anchors.fill: parent
            spacing: 0
            CalendarHeaderElement {dayOfWeek: 1}
            CalendarHeaderElement {dayOfWeek: 2}
            CalendarHeaderElement {dayOfWeek: 3}
            CalendarHeaderElement {dayOfWeek: 4}
            CalendarHeaderElement {dayOfWeek: 5}
            CalendarHeaderElement {dayOfWeek: 6}
            CalendarHeaderElement {dayOfWeek: 7}
        }
    }

    highlight: Rectangle {
    }

    MouseArea {
        anchors.fill: parent
        onClicked: {
            parent.currentIndex = parent.indexAt(mouseX, mouseY)
            parent.focus=true
        }
        onDoubleClicked: {
            dateChanged()
        }
    }
}
